/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.impl;

import ms.jasim.framework.IJasimAppContext;
import ms.jasim.framework.SolutionSimulator.SimulatorArg;
import ms.jasim.model.*;
import ms.jasim.model.items.ActorItem;
import ms.jasim.model.items.GoalItem;
import ms.jasim.model.items.IntItem;
import ms.jasim.model.items.ItemList;
import ms.jasim.model.items.TextItem;
import ms.jasim.pddl.PddlPredicate;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static ModelFactory init() {
		try {
			ModelFactory theModelFactory = (ModelFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.example.org/jasim"); 
			if (theModelFactory != null) {
				return theModelFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new ModelFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModelFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case ModelPackage.MODEL_OBJECT: return createModelObject();
			case ModelPackage.NAMED_MODEL_OBJECT: return createNamedModelObject();
			case ModelPackage.JASIM_MODEL: return createJasimModel();
			case ModelPackage.JASIM_TEMPLATE: return createJasimTemplate();
			case ModelPackage.CUSTOMIZABLE_OBJECT: return createCustomizableObject();
			case ModelPackage.ACTOR: return createActor();
			case ModelPackage.GOAL: return createGoal();
			case ModelPackage.GOAL_REQUEST: return createGoalRequest();
			case ModelPackage.DEPENDENCY: return createDependency();
			case ModelPackage.DECOMPOSITION: return createDecomposition();
			case ModelPackage.CAPABILITY: return createCapability();
			case ModelPackage.EVALUATOR_LIST: return createEvaluatorList();
			case ModelPackage.EVALUATOR: return createEvaluator();
			case ModelPackage.ACTOR_LIST: return createActorList();
			case ModelPackage.GOAL_LIST: return createGoalList();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case ModelPackage.DECOMPOSE_TYPE:
				return createDecomposeTypeFromString(eDataType, initialValue);
			case ModelPackage.JASIM_APP_CONTEXT:
				return createJasimAppContextFromString(eDataType, initialValue);
			case ModelPackage.PDDL_PREDICATE:
				return createPddlPredicateFromString(eDataType, initialValue);
			case ModelPackage.URI:
				return createURIFromString(eDataType, initialValue);
			case ModelPackage.SIMULATOR_ARG:
				return createSimulatorArgFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case ModelPackage.DECOMPOSE_TYPE:
				return convertDecomposeTypeToString(eDataType, instanceValue);
			case ModelPackage.JASIM_APP_CONTEXT:
				return convertJasimAppContextToString(eDataType, instanceValue);
			case ModelPackage.PDDL_PREDICATE:
				return convertPddlPredicateToString(eDataType, instanceValue);
			case ModelPackage.URI:
				return convertURIToString(eDataType, instanceValue);
			case ModelPackage.SIMULATOR_ARG:
				return convertSimulatorArgToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModelObject createModelObject() {
		ModelObjectImpl modelObject = new ModelObjectImpl();
		return modelObject;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NamedModelObject createNamedModelObject() {
		NamedModelObjectImpl namedModelObject = new NamedModelObjectImpl();
		return namedModelObject;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JasimModel createJasimModel() {
		JasimModelImpl jasimModel = new JasimModelImpl();
		return jasimModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JasimTemplate createJasimTemplate() {
		JasimTemplateImpl jasimTemplate = new JasimTemplateImpl();
		return jasimTemplate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CustomizableObject createCustomizableObject() {
		CustomizableObjectImpl customizableObject = new CustomizableObjectImpl();
		return customizableObject;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Actor createActor() {
		ActorImpl actor = new ActorImpl();
		return actor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Goal createGoal() {
		GoalImpl goal = new GoalImpl();
		return goal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GoalRequest createGoalRequest() {
		GoalRequestImpl goalRequest = new GoalRequestImpl();
		return goalRequest;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Dependency createDependency() {
		DependencyImpl dependency = new DependencyImpl();
		return dependency;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Decomposition createDecomposition() {
		DecompositionImpl decomposition = new DecompositionImpl();
		return decomposition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Capability createCapability() {
		CapabilityImpl capability = new CapabilityImpl();
		return capability;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Evaluator createEvaluator() {
		EvaluatorImpl evaluator = new EvaluatorImpl();
		return evaluator;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActorList createActorList() {
		ActorListImpl actorList = new ActorListImpl();
		return actorList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GoalList createGoalList() {
		GoalListImpl goalList = new GoalListImpl();
		return goalList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DecomposeType createDecomposeTypeFromString(EDataType eDataType, String initialValue) {
		DecomposeType result = DecomposeType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertDecomposeTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EvaluatorList createEvaluatorList() {
		EvaluatorListImpl evaluatorList = new EvaluatorListImpl();
		return evaluatorList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public URI createURIFromString(EDataType eDataType, String initialValue) {
		return (URI)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertURIToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SimulatorArg createSimulatorArgFromString(EDataType eDataType, String initialValue) {
		return (SimulatorArg)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertSimulatorArgToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IJasimAppContext createJasimAppContextFromString(EDataType eDataType, String initialValue) {
		return (IJasimAppContext)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertJasimAppContextToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PddlPredicate createPddlPredicateFromString(EDataType eDataType, String initialValue) {
		return (PddlPredicate)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPddlPredicateToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModelPackage getModelPackage() {
		return (ModelPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static ModelPackage getPackage() {
		return ModelPackage.eINSTANCE;
	}

} //ModelFactoryImpl
